﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=1">
    <meta name="format-detection" content="telephone=no">
    <meta charset="UTF-8">
    <title>test</title>
    <link href="css/flexible.css" rel="stylesheet">
    <link href="css/bootstrap.css"/>
    <link href="css/bootstrap-theme.css"/>
</head>
<body>
    <div id="app-1">
        {{message}}
        <ol>
            <todo-item v-for="item in groceryList" v-bind:todo="item" v-bind:key="item.id"></todo-item>
        </ol>
    </div>
    <br/>
     组件化应用构建复习
    <div id="app-2">
        <ul>
            <tabs v-for="o in tabs" v-bind:obj="o"></tabs>
        </ul>
    </div>
<script src="js/jquery-2.2.0.min.js"></script>
<script src="js/flexible.js"></script>
<script src="js/vue-2.5.16.js"></script>

<script>
    Vue.component('todo-item',{
        props:['todo'],
        template:'<li>{{todo.id}}:{{todo.text}}</li>'
    });

    var app1 = new Vue({
        el:'#app-1',
        data:{
            message:'测试',
            groceryList:[
                {id:0,text:'蔬菜'},
                {id:1,text:'水果'},
                {id:2,text:'随便吃的!'}
            ]
        }
    });

    Vue.component('tabs',{
        props:['obj'],
        template:'<li>{{obj.text}}</li>'
    });

    var app2 = new Vue({
        el:'#app-2',
        data:{
            tabs:[{
                text:'ng',id:1
            },{
                text:'v',id:2
            },{
                text:'r',id:3
            }]
        }
    });
</script>

</body>
</html>